/* Check JER_BM_To_old_schedule_Dumb(). */
#include <stdio.h>
#include "jerasure.h"
#include "liberation.h"
#include "reed_sol.h"

int main( int argc, char** argv )
{
	int *old_bitmatrix;
	int *old_matrix;
	int*** old_schedule_cache;
	int m = atoi( argv[1] );
	int k = atoi( argv[2] );
	int w = atoi( argv[3] );
	int i, j;

	old_bitmatrix = liberation_coding_bitmatrix( k, w );
	if( old_bitmatrix != NULL )
		jerasure_print_bitmatrix( old_bitmatrix, 2*w, k*w, w );
	old_schedule_cache = jerasure_generate_schedule_cache( k, 2, w, old_bitmatrix, 0 );
	fprintf( stdout, "Cache size = %d\n", (k+2) * (k+2) );

	for( j = 0; j < (k+2) * (k+2); j++ )
	{
		for( i = 0; old_schedule_cache[j][i][0] != -1; i++ )
		{
			fprintf( stdout, "<%d,%d,%d,%d,%d>\n", old_schedule_cache[j][i][4], 
					old_schedule_cache[j][i][0], old_schedule_cache[j][i][1], 
					old_schedule_cache[j][i][2], old_schedule_cache[j][i][3] );
		}
	}

	return 0;
}
